<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加点标</title>

    <!--判断是否登陆-->
    <script type="text/javascript" src="../../vendor/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="../../js/config.js"></script>
    <script type="text/javascript" src="../../js/jquerySession.js"></script>
    <script type="text/javascript">
        if ($.session.get('token') == null) {
            alert("用户未登录！");
            window.location.href = "../../login.html"
        }
    </script>

    <script type="text/javascript">
        //获取url地址传递过来的参数
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        }
        var id = getUrlParam("id");

        $.getJSON(clientUrl + "/points/" + id, function (json) {
            if (json.meta.code == "200") {
                var data = json.data;
                $(".point").val(data.address);
            }
        })

    </script>
</head>
<style type="text/css">
    .box {

        margin: 0px auto;
        width: 100%;

    }

    .box ul {

        margin: 0px auto;
        padding-left: 0px;
        width: 400px;

    }

    .box ul li {

        list-style-type: none;

    }

    .box ul li .point_select {

        width: 256px;
        height: 32px;
        margin-right: 10px;
        margin-bottom: 5px;

    }

    .box ul li input {

        height: 24px;
        width: 250px;

    }

    .box ul li span, input {

        margin: 5px 10px;

    }

    .box ul li {

        text-align: right;

    }

    .box ul li img {

        line-height: 19px;

    }

    .box ul .division {

        height: 10px;
        border-bottom: dashed #eeeeee 1px;
        margin-bottom: 10px;

    }

    .box ul .vote_selection {

        text-align: center;
        vertical-align: bottom;
        height: 20px;

    }

    .box ul .vote_selection .add_btn {

        line-height: 20px;
        width: 16px;
        height: 16px;
        padding-bottom: 3px;
        border: 0px;
        background: url("../../images/add.png") no-repeat;

    }

    .box ul li .del_btn {

        line-height: 20px;
        width: 16px;
        height: 16px;
        padding-bottom: 3px;
        border: 0px;
        background: url("../../images/del.png") no-repeat;

    }

</style>
<body>
<div class="box">
    <form>
        <ul id="voteList">
            <li class="division"></li>
            <li>
                <input type="file" name="file" class="file"/>
            </li>
            <li class="division"></li>
            <li class="vote_selection">
                点标地址
                <span>
                <input type="text" name="point" class="point"/>
            </span>
            </li>
        </ul>

    </form>

</div>

<script type="text/javascript">

$(function(){
    //图片文件大小控制
    $(".file").change(function () {
        var fileInput = $(".file")[0];
        var byteSize = fileInput.files[0].size;
        if (byteSize > 1024 * 1024) {
            alert("图片大小超过1M");
            $(".file").val("");
        }
    });

})
</script>
</body>
</html>